package com.lagou.handler;

import com.lagou.entity.RpcRequest;
import com.lagou.server.UserServiceImpl;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * @author sxnan
 * @className UserServerHandler
 * @description TODO
 * @date 2020/8/18
 */
public class UserServerHandler extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
            //如果符合规则，调用实现类返回一个result
            String result = new UserServiceImpl().sayHello((RpcRequest) msg);
            //返回结果到客户端
            ctx.writeAndFlush(result);
    }
}
